{% load static %}
{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{% block title %}问答社区{% endblock %}</title>
    
    <!-- 引入Bootstrap 3 CSS - 使用项目中已有的文件 -->
    <link rel="stylesheet" href="{% static 'js/bootstrap-3.4.1-dist/css/bootstrap.min.css' %}">
    
    <!-- 少量自定义样式 -->
    <link rel="stylesheet" href="{% static 'css/styles.css' %}">
    
    <!-- 页面特定CSS -->
    {% block css %}

    {% endblock %}

<!-- 引入jQuery和Bootstrap 3 JS - 使用项目中已有的文件 -->
    <script src="{% static 'js/jquery-3.7.1.min.js' %}"></script>
    <script src="{% static 'js/bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>


    <!-- 页面特定JavaScript -->
    {% block js %}{% endblock %}

</head>

<body>


    <!-- 导航栏 - 完全使用Bootstrap 3组件 -->
    <nav class="navbar navbar-default">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
                    <span class="sr-only">切换导航</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="{% url 'main:home' %}">问答社区</a>
            </div>

            <div class="collapse navbar-collapse" id="navbar-collapse">
                <ul class="nav navbar-nav">
                    <li><a href="{% url 'main:topic_list' %}">话题</a></li>
                </ul>

                <form class="navbar-form navbar-left" method='get' action="/search/">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="你想参与哪些问答" name="q">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>

                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                    <li><a href="{% url 'main:create_question' %}">提问</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            {{ user.username }} <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'user:center' %}">个人中心</a></li>
                            <li><a href="{% url 'user:change_name' %}">修改名字</a></li>
                            <li><a href="{% url 'user:change_head' %}">修改头像</a></li>
                            <li><a href="{% url 'user:change_password' %}">修改密码</a></li>
                            <li><a href="{% url 'user:my_collections' %}">我的收藏</a></li>

                            <li class="divider"></li>
                            <li><a href="{% url 'user:logout' %}">登出</a></li>
                        </ul>
                    </li>
                    {% else %}
                    <li><a href="{% url 'user:register' %}">注册</a></li>
                    <li><a href="{% url 'user:login' %}">登录</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>




    <!-- 主内容区域 -->
    <div class="container">
        <!-- 消息提示区域 -->
        {% if messages %}
        <div class="row">
            <div class="col-md-12">
                {% for message in messages %}
                <div class="alert alert-{{ message.tags }}">
                    <button type="button" class="close" data-dismiss="alert" aria-label="关闭">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    {{ message }}
                </div>
                {% endfor %}
            </div>
        </div>
        {% endif %}
        
        <!-- 内容块 -->
        {% block content %}{% endblock %}
    </div>

    <!-- 页脚 - 使用Bootstrap栅格系统 -->
    <footer class="footer">
        <div class="container">
            <div class="row">
                <div class="col-md-12 text-center">
                    <p>&copy; 2025 问答社区 - 基于 Django 构建 - 联系管理员：842411430@qq.com</p>
                </div>
            </div>
        </div>
    </footer>



</body>
</html>
